package thread;

/*
    推到Lambda 表达式
 */
public class TestLambda01 {

    //3.静态内部类
    static class Like2 implements ILik{

        @Override
        public void lambda() {
            System.out.println("I like Lambda2!");
        }
    }

    public static void main(String[] args) {
        ILik like = new Like();
        like.lambda();

        ILik like2 = new Like2();
        like2.lambda();

        //4.局部内部类
        class Like3 implements ILik{

            @Override
            public void lambda() {
                System.out.println("I like Lambda3!");
            }
        }

        ILik like3 = new Like3();
        like3.lambda();

        //5.匿名内部类
        ILik like4 = new ILik() {
            @Override
            public void lambda() {
                System.out.println("I like Lambda4!");
            }
        };
        like4.lambda();

        //6.JDK1.8 Lambda简化

        ILik like5 = ()-> System.out.println("I like Lambda5!");
        like5.lambda();

    }

}

//1.定义一个函数式接口
interface ILik{
    void lambda();
}

//2.实现类
class Like implements ILik{

    @Override
    public void lambda() {
        System.out.println("I like Lambda!");
    }
}